﻿<%@ Page Title="" Language="C#" MasterPageFile="Admin.master" ValidateRequest="false"  Debug="true" %>

<script runat="server">
    public int Item_Id = 0;
    Agents NewAgents;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            Item_Id = Convert.ToInt32(Request.QueryString["id"].ToString());
            if (!IsPostBack)
            {
                NewAgents = new Agents(Item_Id);
                Agent_Name.Value = NewAgents.Agent_Name;
                Agent_Site.Value = NewAgents.Agent_Site;
                Agent_Address.Value = NewAgents.Agent_Address;
                Agent_Tel.Value = NewAgents.Agent_Tel;
                Orders.Value = NewAgents.Orders + "";
                Map.Value = NewAgents.Agent_Map;
                
                //语言绑定
                SubmitButton.Text = Lang.Show("Submit");
            }

        }
    }
    protected void Unnamed1_Click1(object sender, EventArgs e)
    {
        if (Item_Id > 0)
        {
            NewAgents = new Agents();
            if (NewAgents.Item_AddEdit(Item_Id, Agent_Name.Value, Agent_Tel.Value, Agent_Site.Value, Agent_Address.Value, Convert.ToInt32(Orders.Value),1,Map.Value) > 0)
                Response.Redirect("Agents.aspx");
        }
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><%=Lang.Show("AgentsCenter")%> - <%=Lang.Show("Edit")%></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<form runat="server">
<table class="inputs">
    <tr>
        <td><%=Lang.Show("UserName") %> : </td>
        <td><input type="text" id="Agent_Name"  runat="server"  /></td>
        <td></td>
    </tr>
    <tr>
        <td><%=Lang.Show("Zone")%> : </td>
        <td><input type="text" id="Agent_Site" runat="server"   /></td>
        <td></td>
    </tr>
    <tr>
        <td><%=Lang.Show("UserPhone")%> : </td>
        <td><input type="text" id="Agent_Tel" runat="server"   /></td>
        <td></td>
    </tr>
    <tr>
        <td><%=Lang.Show("Address")%> : </td>
        <td><textarea id="Agent_Address" runat="server" rows="5" ></textarea></td>
        <td></td>
    </tr>
    <tr>
        <td><%=Lang.Show("Order")%> : </td>
        <td><input type="text" id="Orders" runat="server"  /></td>
        <td><p><%=Lang.Show("OrderDirections")%></p></td>
    </tr>
    <tr>
        <td><%=Lang.Show("Map")%> : </td>
        <td><textarea id="Map" class="cn" runat="server" rows="5" ></textarea></td>
        <td></td>
    </tr>
    <tr>
        <td></td>
        <td><asp:Button ID="SubmitButton" runat="server" CssClass="button"  onclick="Unnamed1_Click1" /></td>
        <td></td>
    </tr>
</table>
</form>
</asp:Content>

